import request from "@/common/http";
import jobListResponse from './mock/jobList.json'
import {Job} from "@/pages/system/user/constant";

export function apiGetJobList(params: any, useMock?: boolean): Promise<any> {
  if (useMock) {
    return Promise.resolve(jobListResponse)
  }
  return request.get('/gateway/ums/sys-role', params)
}

export async function queryJob(params?: any) {
  return request('/api/sys/job/list', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function removeJobOne(params: { id: number }) {
  return request('/api/sys/job/delete', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function removeJob(params: { ids: number[] }) {
  return request('/api/sys/job/delete', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function addJob(params: Job) {
  return request('/api/sys/job/add', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function updateJob(params: Job) {
  return request('/api/sys/job/update', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
